#-------------------------------------------------------------------------------
# Random generate test purpose users.
#-------------------------------------------------------------------------------
def random_generate_test_user():
    words = 'abcdefghijklmnopqrstuvwxyz '
    nums = '1234567890-'
    types = ['is_producer','is_artist','is_client']
    import random

    for i in range(20):
        first_name = ''.join([words[random.randint(0,25)] for x in range(7)])
        last_name = ''.join([words[random.randint(0,25)] for x in range(7)])
        
        username = ''.join([words[random.randint(0,25)] for x in range(8)])
        role = ''.join([words[random.randint(0,26)] for x in range(8)])
        email = ''.join([words[random.randint(0,25)] for x in range(8)])
        email = email + '@' + ''.join([words[random.randint(0,25)] for x in range(3)]) + '.se'
        phone = ''.join([nums[random.randint(0,10)] for x in range(10)])
        office = ''.join([words[random.randint(0,26)] for x in range(11)])
        
        _user = User()
        _user.username = username
        _user.first_name = first_name
        _user.last_name = last_name
        _user.email = email
        _user.password = '1'
        _user.save()
        _user.user_permissions.add(
                Permission.objects.get(codename = types[random.randint(0,2)]))
        _user.save()
        
        up = User_profile()
        up.user = _user
        up.role = role
        up.office = office
        up.phone = phone
        up.save()